package com.bookstore.admin.product.service;

import com.bookstore.admin.product.dao.AdminProductDao;
import com.bookstore.commons.beans.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * company: www.abc.com
 * Author: Administrator
 * Create Data: 2021/6/2 0002
 */
@Service
public class AdminProductServiceImple implements AdminProductService {

    @Autowired
    AdminProductDao adminProductDao;

    @Override
    public List<Product> findProductList() {
        return adminProductDao.selectProductList();
    }

    @Override
    public Product findProductById(String id) {
        return adminProductDao.selectProductById(id);
    }

    @Override
    public int deleteProduct(String id) {
        return adminProductDao.deleteProduct(id);
    }

    @Override
    public int editProduct(Product product) {
        return adminProductDao.updateProduct(product);
    }

    @Override
    public List<Product> findProductByManyCondition(Product product, Double minprice, Double maxprice) {
        return adminProductDao.selectProductByManyCondition(product,minprice,maxprice);
    }

    @Override
    public int findProductCountByCategory(Product product, Double minprice, Double maxprice) {
        return adminProductDao.selectCount(product,minprice,maxprice);
    }

    @Override
    public List<ProductList> findProductSalList(String year, String month) {
        return adminProductDao.selectProductSalList(year,month);
    }

    @Override
    public int addProduct(Product product) {
        return adminProductDao.insertProduct(product);
    }

    @Override
    public List<Order> findOrderList(Order order) {
        return adminProductDao.selectOrderList(order);
    }

    @Override
    public List<Orderitem> findOrderItemById(String id) {
        return adminProductDao.selectOrderItemById(id);
    }

    @Override
    public List<Notice> findNotice() {
        return adminProductDao.selectNotice();
    }

    @Override
    public Notice FindByIdNoticeServlet(Integer id) {
        return adminProductDao.selectByIdNoticeServlet(id);
    }

    @Override
    public int EditNoticeServlet(Notice notice) {
        return adminProductDao.updateNoticeService(notice);
    }

    @Override
    public int DeleteNoticeServlet(Integer id) {
        return adminProductDao.delectNoticeService(id);
    }

    @Override
    public int AddNoticeServlet(Notice notice) {
        return adminProductDao.addNoticeServlet(notice);
    }

    @Override
    public Integer findUser(String logonName, String logonPwd) {
        return adminProductDao.selectUser(logonName,logonPwd);
    }


}
